package org.liveboardgames.agricola.domain;

import org.liveboardgames.agricola.domain.board.BoardTile;
import org.liveboardgames.agricola.domain.card.Card;
import org.liveboardgames.agricola.domain.farm.Farm;
import org.liveboardgames.agricola.domain.farm.FarmTile;
import org.liveboardgames.agricola.model.structure.Visitable;
import org.liveboardgames.agricola.model.structure.Visitor;

public class Change implements Visitable {

  private String type;

  private Object object;

  public Change(String type, Object object) {
    this.object = object;
    this.type = type;
  }

  public String getType() {
    return type;
  }

  public void setType(String type) {
    this.type = type;
  }

  public Object getObject() {
    return object;
  }

  public void setObject(Object object) {
    this.object = object;
  }

  public void acceptVisit(Visitor visitor) {
    if (object instanceof Game) {
      ((Game)object).acceptVisit(visitor);
    }
    else if (object instanceof BoardTile) {
      ((BoardTile)object).acceptVisit(visitor);
    }
    else if (object instanceof Card) {
      ((Card)object).acceptVisit(visitor);
    }
    else if (object instanceof FarmTile) {
      ((FarmTile)object).acceptVisit(visitor);
    }
    else if (object instanceof Farm) {
      ((Farm)object).acceptVisit(visitor);
    }
  }
}
